package com.perfect

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.example.zjx8969.myapplication.App

object DataBaseHolder {
    private var appDataBase: AppDataBase? = null
    fun getAppDataBase(): AppDataBase {
        if (appDataBase == null) {
            synchronized(DataBaseHolder::class) {
                if (appDataBase == null) appDataBase = Room.databaseBuilder(App.app, AppDataBase::class.java, "app.db").build()
            }
        }
        return appDataBase!!
    }
}

@Database(entities = [ArtistAccount::class, Styles::class, BrandItem::class, BrandStyleItem::class], version = 1)
abstract class AppDataBase : RoomDatabase() {
    abstract fun getArtistDao(): ArtistsDao
    abstract fun getStyleDao(): StyleDao

    abstract fun getBrandDao(): BrandDao
    abstract fun getBrandStyleDao(): BrandStyleDao

}